
#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
#endregion

namespace Dragoon.BreakIt.View
{
    /// <summary>
    /// This class contains the components that makes up the game
    /// </summary>
    public class BreakItGame : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;

        /// <summary>
        /// Constructs a new game instance
        /// </summary>
        /// <remarks>
        /// The constructor must setup the graphics device manager
        /// </remarks>
        public BreakItGame()
        {
            graphics = new GraphicsDeviceManager(this);
#if DEBUG
            graphics.IsFullScreen = false;
#else

            graphics.SynchronizeWithVerticalRetrace = true;
            graphics.PreferredBackBufferWidth = 1152;
            graphics.PreferredBackBufferHeight = 864;
            graphics.PreferMultiSampling = true;
            graphics.IsFullScreen = true;
#endif
            IsFixedTimeStep = false;
        }


        protected override void Initialize()
        {
            PlayScene scene = new PlayScene(this);

            BackgroundRenderer background = 
                 new BackgroundRenderer(this,                   
                        new Rectangle(0, 0,
                            Window.ClientBounds.Width,
                            Window.ClientBounds.Height), 
                16, 12, scene.Tiles);
            scene.InnerRect = background.InnerRect;

#if TRACE
            Components.Add(new FPSCounter(this));
#endif
            Components.Add(background);
            Components.Add(scene);

            base.Initialize();
        }




        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                this.Exit();

            base.Update(gameTime);
        }


    }
}